use crate::key_manager::error::KeyManagerError;
use crate::key_manager::lifecycle::key_observer::observer_init::register::register_observer;
use crate::key_manager::lifecycle::key_observer::KeyLifecycleObserver;
use ctor::ctor;
use sea_orm::DatabaseTransaction;
use std::sync::Arc;
use crate::key_manager::lifecycle::key_observer::key_lifecycle_observer::BoxFuture;

#[derive(Debug)]
pub struct CertificateManager;

unsafe impl Send for CertificateManager{}
unsafe impl Sync for CertificateManager{}

impl KeyLifecycleObserver for CertificateManager {
    fn signature_update(&self, _key_version: &str, _tx: Arc<DatabaseTransaction>) -> BoxFuture<Result<(), Box<KeyManagerError>>> {
        Box::pin(async move {
            Ok(())
        })
    }
}

#[ctor]
fn register_certificate_manager() {
    register_observer(Arc::new(CertificateManager));
}
